package com.ykt.mall.ctrl;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Page;
import com.ykt.interceptor.Seach;
import com.ykt.model.Shop;
import com.ykt.model.ShopType;

@ControllerBind(controllerKey = "/")
public class IndexCtrl extends Controller{
	//@ClearInterceptor(ClearLayer.ALL)
	@Before(Seach.class)
	public void index(){
		
		Seach seach = getAttr("seachBean");
		int page=getParaToInt("page", 1);
		int rows=this.getParaToInt("rows", 10);
		try {
			Page<ShopType> data= ShopType.dao.paginate(page,rows,null);
			int count = data.getList().size();
			setAttr("page", data);
			setAttr("count",count);
			render("/template/index.html");
		} catch (Exception e) {
		}
		//redirect("/shop/1");
	}
	
}
